﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using DataAccess.Helpers;
using System.ComponentModel.DataAnnotations;

namespace DataAccess
{
	[global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Article")]
	public partial class Article : INotifyPropertyChanging, INotifyPropertyChanged
	{
		public IEnumerable<Comment> AllComments { get { return DataRepository.Get<Comment>().Where(c => c.id_Item == id_Article && c.CommentType == (byte)CommentType.Article); } }

		public IEnumerable<Comment> ValidComments { get { return DataRepository.Get<Comment>().Where(c => c.id_Item == id_Article && c.CommentType == (byte)CommentType.Article && c.Validation == (byte)ValidationType.Valide); } }

		public static IEnumerable<Category> AvailableCategories { get { return DataRepository.Get<Category>().Where(c => c.CategoryType == (byte)CategoryType.Article); } }

		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

		private int _id_Article;

		private int _id_Category;

		private bool _DisplayHome;

		private string _Title;

		private string _Introduction;

		private string _Content;

		private byte _Status;

		private System.DateTime _CreationDate;

		private System.DateTime _EditDate;

		private EntityRef<Category> _Category;

		#region Extensibility Method Definitions
		partial void OnLoaded();
		partial void OnValidate(System.Data.Linq.ChangeAction action);
		partial void OnCreated();
		partial void Onid_ArticleChanging(int value);
		partial void Onid_ArticleChanged();
		partial void Onid_UserChanging(System.Nullable<int> value);
		partial void Onid_UserChanged();
		partial void Onid_CategoryChanging(int value);
		partial void Onid_CategoryChanged();
		partial void OnDisplayHomeChanging(bool value);
		partial void OnDisplayHomeChanged();
		partial void OnTitleChanging(string value);
		partial void OnTitleChanged();
		partial void OnIntroductionChanging(string value);
		partial void OnIntroductionChanged();
		partial void OnContentChanging(string value);
		partial void OnContentChanged();
		partial void OnStatusChanging(byte value);
		partial void OnStatusChanged();
		partial void OnCreationDateChanging(System.DateTime value);
		partial void OnCreationDateChanged();
		partial void OnEditDateChanging(System.DateTime value);
		partial void OnEditDateChanged();
		#endregion

		public Article()
		{
			this._Category = default(EntityRef<Category>);
			OnCreated();
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_id_Article", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
		public int id_Article
		{
			get
			{
				return this._id_Article;
			}
			set
			{
				if ((this._id_Article != value))
				{
					this.Onid_ArticleChanging(value);
					this.SendPropertyChanging();
					this._id_Article = value;
					this.SendPropertyChanged("id_Article");
					this.Onid_ArticleChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_id_Category", DbType = "Int NOT NULL")]
		[Required(ErrorMessage = "Obligatoire")]
		[Display(Name = "Rubrique")]
		public int id_Category
		{
			get
			{
				return this._id_Category;
			}
			set
			{
				if ((this._id_Category != value))
				{
					if (this._Category.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.Onid_CategoryChanging(value);
					this.SendPropertyChanging();
					this._id_Category = value;
					this.SendPropertyChanged("id_Category");
					this.Onid_CategoryChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_DisplayHome", DbType = "Bit NOT NULL")]
		[Display(Name = "Article à la une")]
		public bool DisplayHome
		{
			get
			{
				return this._DisplayHome;
			}
			set
			{
				if ((this._DisplayHome != value))
				{
					this.OnDisplayHomeChanging(value);
					this.SendPropertyChanging();
					this._DisplayHome = value;
					this.SendPropertyChanged("DisplayHome");
					this.OnDisplayHomeChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Title", DbType = "NVarChar(255) NOT NULL", CanBeNull = false)]
		[StringLength(255, MinimumLength = 2, ErrorMessage = "Le titre doit faire entre 2 et 255 caractères")]
		[Required(ErrorMessage = "Obligatoire")]
		[Display(Name = "Titre")]
		public string Title
		{
			get
			{
				return this._Title;
			}
			set
			{
				if ((this._Title != value))
				{
					this.OnTitleChanging(value);
					this.SendPropertyChanging();
					this._Title = value;
					this.SendPropertyChanged("Title");
					this.OnTitleChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Introduction", DbType = "NText NOT NULL", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
		[Required(ErrorMessage = "Obligatoire")]
		[Display(Name = "Introduction")]
		public string Introduction
		{
			get
			{
				return this._Introduction;
			}
			set
			{
				if ((this._Introduction != value))
				{
					this.OnIntroductionChanging(value);
					this.SendPropertyChanging();
					this._Introduction = value;
					this.SendPropertyChanged("Introduction");
					this.OnIntroductionChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Content", DbType = "NText NOT NULL", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
		[Required(ErrorMessage = "Obligatoire")]
		[Display(Name = "Contenu")]
		public string Content
		{
			get
			{
				return this._Content;
			}
			set
			{
				if ((this._Content != value))
				{
					this.OnContentChanging(value);
					this.SendPropertyChanging();
					this._Content = value;
					this.SendPropertyChanged("Content");
					this.OnContentChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Status", DbType = "TinyInt NOT NULL")]
		public byte Status
		{
			get
			{
				return this._Status;
			}
			set
			{
				if ((this._Status != value))
				{
					this.OnStatusChanging(value);
					this.SendPropertyChanging();
					this._Status = value;
					this.SendPropertyChanged("Status");
					this.OnStatusChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CreationDate", DbType = "DateTime NOT NULL")]
		public System.DateTime CreationDate
		{
			get
			{
				return this._CreationDate;
			}
			set
			{
				if ((this._CreationDate != value))
				{
					this.OnCreationDateChanging(value);
					this.SendPropertyChanging();
					this._CreationDate = value;
					this.SendPropertyChanged("CreationDate");
					this.OnCreationDateChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_EditDate", DbType = "DateTime NOT NULL")]
		public System.DateTime EditDate
		{
			get
			{
				return this._EditDate;
			}
			set
			{
				if ((this._EditDate != value))
				{
					this.OnEditDateChanging(value);
					this.SendPropertyChanging();
					this._EditDate = value;
					this.SendPropertyChanged("EditDate");
					this.OnEditDateChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.AssociationAttribute(Name = "Category_Article", Storage = "_Category", ThisKey = "id_Category", OtherKey = "id_Category", IsForeignKey = true)]
		public Category Category
		{
			get
			{
				return this._Category.Entity;
			}
			set
			{
				Category previousValue = this._Category.Entity;
				if (((previousValue != value)
							|| (this._Category.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Category.Entity = null;
						previousValue.Articles.Remove(this);
					}
					this._Category.Entity = value;
					if ((value != null))
					{
						value.Articles.Add(this);
						this._id_Category = value.id_Category;
					}
					else
					{
						this._id_Category = default(int);
					}
					this.SendPropertyChanged("Category");
				}
			}
		}

		public event PropertyChangingEventHandler PropertyChanging;

		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}

		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}

	[global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Category")]
	public partial class Category : INotifyPropertyChanging, INotifyPropertyChanged
	{

		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

		private int _id_Category;

		private byte _CategoryType;

		private string _Description;

		private string _ColorCode;

		private EntitySet<Article> _Articles;

		private EntitySet<Event> _Events;

		#region Extensibility Method Definitions
		partial void OnLoaded();
		partial void OnValidate(System.Data.Linq.ChangeAction action);
		partial void OnCreated();
		partial void Onid_CategoryChanging(int value);
		partial void Onid_CategoryChanged();
		partial void OnCategoryTypeChanging(byte value);
		partial void OnCategoryTypeChanged();
		partial void OnDescriptionChanging(string value);
		partial void OnDescriptionChanged();
		partial void OnColorCodeChanging(string value);
		partial void OnColorCodeChanged();
		#endregion

		public Category()
		{
			this._Articles = new EntitySet<Article>(new Action<Article>(this.attach_Articles), new Action<Article>(this.detach_Articles));
			this._Events = new EntitySet<Event>(new Action<Event>(this.attach_Events), new Action<Event>(this.detach_Events));
			OnCreated();
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_id_Category", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
		public int id_Category
		{
			get
			{
				return this._id_Category;
			}
			set
			{
				if ((this._id_Category != value))
				{
					this.Onid_CategoryChanging(value);
					this.SendPropertyChanging();
					this._id_Category = value;
					this.SendPropertyChanged("id_Category");
					this.Onid_CategoryChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CategoryType", DbType = "TinyInt NOT NULL")]
		public byte CategoryType
		{
			get
			{
				return this._CategoryType;
			}
			set
			{
				if ((this._CategoryType != value))
				{
					this.OnCategoryTypeChanging(value);
					this.SendPropertyChanging();
					this._CategoryType = value;
					this.SendPropertyChanged("CategoryType");
					this.OnCategoryTypeChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Description", DbType = "NVarChar(50) NOT NULL", CanBeNull = false)]
		public string Description
		{
			get
			{
				return this._Description;
			}
			set
			{
				if ((this._Description != value))
				{
					this.OnDescriptionChanging(value);
					this.SendPropertyChanging();
					this._Description = value;
					this.SendPropertyChanged("Description");
					this.OnDescriptionChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_ColorCode", DbType = "NChar(6)")]
		public string ColorCode
		{
			get
			{
				return this._ColorCode;
			}
			set
			{
				if ((this._ColorCode != value))
				{
					this.OnColorCodeChanging(value);
					this.SendPropertyChanging();
					this._ColorCode = value;
					this.SendPropertyChanged("ColorCode");
					this.OnColorCodeChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.AssociationAttribute(Name = "Category_Article", Storage = "_Articles", ThisKey = "id_Category", OtherKey = "id_Category")]
		public EntitySet<Article> Articles
		{
			get
			{
				return this._Articles;
			}
			set
			{
				this._Articles.Assign(value);
			}
		}

		[global::System.Data.Linq.Mapping.AssociationAttribute(Name = "Category_Event", Storage = "_Events", ThisKey = "id_Category", OtherKey = "id_Category")]
		public EntitySet<Event> Events
		{
			get
			{
				return this._Events;
			}
			set
			{
				this._Events.Assign(value);
			}
		}

		public event PropertyChangingEventHandler PropertyChanging;

		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}

		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}

		private void attach_Articles(Article entity)
		{
			this.SendPropertyChanging();
			entity.Category = this;
		}

		private void detach_Articles(Article entity)
		{
			this.SendPropertyChanging();
			entity.Category = null;
		}

		private void attach_Events(Event entity)
		{
			this.SendPropertyChanging();
			entity.Category = this;
		}

		private void detach_Events(Event entity)
		{
			this.SendPropertyChanging();
			entity.Category = null;
		}
	}

	[global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Event")]
	public partial class Event : INotifyPropertyChanging, INotifyPropertyChanged
	{
		public IEnumerable<Comment> AllComments { get { return DataRepository.Get<Comment>().Where(c => c.id_Item == id_Event && c.CommentType == (byte)CommentType.Evenement); } }

		public IEnumerable<Comment> ValidComments { get { return DataRepository.Get<Comment>().Where(c => c.id_Item == id_Event && c.CommentType == (byte)CommentType.Evenement && c.Validation == (byte)ValidationType.Valide); } }

		public IEnumerable<Category> AvailableCategories { get { return DataRepository.Get<Category>().Where(c => c.CategoryType == (byte)CategoryType.Evenement); } }

		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

		private int _id_Event;

		private int _id_Category;

		private System.DateTime _EventDate;

		private string _Location;

		private string _Title;

		private string _Summary;

		private string _Content;

		private byte _Status;

		private System.DateTime _CreationDate;

		private System.DateTime _EditDate;

		private EntityRef<Category> _Category;

		#region Extensibility Method Definitions
		partial void OnLoaded();
		partial void OnValidate(System.Data.Linq.ChangeAction action);
		partial void OnCreated();
		partial void Onid_EventChanging(int value);
		partial void Onid_EventChanged();
		partial void Onid_UserChanging(int value);
		partial void Onid_UserChanged();
		partial void Onid_CategoryChanging(int value);
		partial void Onid_CategoryChanged();
		partial void OnEventDateChanging(System.DateTime value);
		partial void OnEventDateChanged();
		partial void OnLocationChanging(string value);
		partial void OnLocationChanged();
		partial void OnTitleChanging(string value);
		partial void OnTitleChanged();
		partial void OnSummaryChanging(string value);
		partial void OnSummaryChanged();
		partial void OnContentChanging(string value);
		partial void OnContentChanged();
		partial void OnStatusChanging(byte value);
		partial void OnStatusChanged();
		partial void OnCreationDateChanging(System.DateTime value);
		partial void OnCreationDateChanged();
		partial void OnEditDateChanging(System.DateTime value);
		partial void OnEditDateChanged();
		#endregion

		public Event()
		{
			this._Category = default(EntityRef<Category>);
			OnCreated();
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_id_Event", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
		public int id_Event
		{
			get
			{
				return this._id_Event;
			}
			set
			{
				if ((this._id_Event != value))
				{
					this.Onid_EventChanging(value);
					this.SendPropertyChanging();
					this._id_Event = value;
					this.SendPropertyChanged("id_Event");
					this.Onid_EventChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_id_Category", DbType = "Int NOT NULL")]
		public int id_Category
		{
			get
			{
				return this._id_Category;
			}
			set
			{
				if ((this._id_Category != value))
				{
					if (this._Category.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.Onid_CategoryChanging(value);
					this.SendPropertyChanging();
					this._id_Category = value;
					this.SendPropertyChanged("id_Category");
					this.Onid_CategoryChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_EventDate", DbType = "DateTime NOT NULL")]
		public System.DateTime EventDate
		{
			get
			{
				return this._EventDate;
			}
			set
			{
				if ((this._EventDate != value))
				{
					this.OnEventDateChanging(value);
					this.SendPropertyChanging();
					this._EventDate = value;
					this.SendPropertyChanged("EventDate");
					this.OnEventDateChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Location", DbType = "NVarChar(255) NOT NULL", CanBeNull = false)]
		public string Location
		{
			get
			{
				return this._Location;
			}
			set
			{
				if ((this._Location != value))
				{
					this.OnLocationChanging(value);
					this.SendPropertyChanging();
					this._Location = value;
					this.SendPropertyChanged("Location");
					this.OnLocationChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Title", DbType = "NVarChar(255) NOT NULL", CanBeNull = false)]
		public string Title
		{
			get
			{
				return this._Title;
			}
			set
			{
				if ((this._Title != value))
				{
					this.OnTitleChanging(value);
					this.SendPropertyChanging();
					this._Title = value;
					this.SendPropertyChanged("Title");
					this.OnTitleChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Summary", DbType = "NVarChar(500) NOT NULL", CanBeNull = false)]
		public string Summary
		{
			get
			{
				return this._Summary;
			}
			set
			{
				if ((this._Summary != value))
				{
					this.OnSummaryChanging(value);
					this.SendPropertyChanging();
					this._Summary = value;
					this.SendPropertyChanged("Summary");
					this.OnSummaryChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Content", DbType = "NText NOT NULL", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
		public string Content
		{
			get
			{
				return this._Content;
			}
			set
			{
				if ((this._Content != value))
				{
					this.OnContentChanging(value);
					this.SendPropertyChanging();
					this._Content = value;
					this.SendPropertyChanged("Content");
					this.OnContentChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Status", DbType = "TinyInt NOT NULL")]
		public byte Status
		{
			get
			{
				return this._Status;
			}
			set
			{
				if ((this._Status != value))
				{
					this.OnStatusChanging(value);
					this.SendPropertyChanging();
					this._Status = value;
					this.SendPropertyChanged("Status");
					this.OnStatusChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CreationDate", DbType = "DateTime NOT NULL")]
		public System.DateTime CreationDate
		{
			get
			{
				return this._CreationDate;
			}
			set
			{
				if ((this._CreationDate != value))
				{
					this.OnCreationDateChanging(value);
					this.SendPropertyChanging();
					this._CreationDate = value;
					this.SendPropertyChanged("CreationDate");
					this.OnCreationDateChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_EditDate", DbType = "DateTime NOT NULL")]
		public System.DateTime EditDate
		{
			get
			{
				return this._EditDate;
			}
			set
			{
				if ((this._EditDate != value))
				{
					this.OnEditDateChanging(value);
					this.SendPropertyChanging();
					this._EditDate = value;
					this.SendPropertyChanged("EditDate");
					this.OnEditDateChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.AssociationAttribute(Name = "Category_Event", Storage = "_Category", ThisKey = "id_Category", OtherKey = "id_Category", IsForeignKey = true)]
		public Category Category
		{
			get
			{
				return this._Category.Entity;
			}
			set
			{
				Category previousValue = this._Category.Entity;
				if (((previousValue != value)
							|| (this._Category.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Category.Entity = null;
						previousValue.Events.Remove(this);
					}
					this._Category.Entity = value;
					if ((value != null))
					{
						value.Events.Add(this);
						this._id_Category = value.id_Category;
					}
					else
					{
						this._id_Category = default(int);
					}
					this.SendPropertyChanged("Category");
				}
			}
		}

		public event PropertyChangingEventHandler PropertyChanging;

		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}

		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}

	[global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Tweet")]
	public partial class Tweet : INotifyPropertyChanging, INotifyPropertyChanged
	{

		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

		private int _id_Tweet;

		private bool _IsBastInfo;

		private string _Pseudo;

		private string _Email;

		private byte _Validation;

		private string _Content;

		private System.DateTime _CreationDate;

		#region Extensibility Method Definitions
		partial void OnLoaded();
		partial void OnValidate(System.Data.Linq.ChangeAction action);
		partial void OnCreated();
		partial void Onid_TweetChanging(int value);
		partial void Onid_TweetChanged();
		partial void OnIsBastInfoChanging(bool value);
		partial void OnIsBastInfoChanged();
		partial void OnPseudoChanging(string value);
		partial void OnPseudoChanged();
		partial void OnEmailChanging(string value);
		partial void OnEmailChanged();
		partial void OnValidationChanging(byte value);
		partial void OnValidationChanged();
		partial void OnContentChanging(string value);
		partial void OnContentChanged();
		partial void OnCreationDateChanging(System.DateTime value);
		partial void OnCreationDateChanged();
		#endregion

		public Tweet()
		{
			OnCreated();
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_id_Tweet", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
		public int id_Tweet
		{
			get
			{
				return this._id_Tweet;
			}
			set
			{
				if ((this._id_Tweet != value))
				{
					this.Onid_TweetChanging(value);
					this.SendPropertyChanging();
					this._id_Tweet = value;
					this.SendPropertyChanged("id_Tweet");
					this.Onid_TweetChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_IsBastInfo", DbType = "Bit NOT NULL")]
		public bool IsBastInfo
		{
			get
			{
				return this._IsBastInfo;
			}
			set
			{
				if ((this._IsBastInfo != value))
				{
					this.OnIsBastInfoChanging(value);
					this.SendPropertyChanging();
					this._IsBastInfo = value;
					this.SendPropertyChanged("IsBastInfo");
					this.OnIsBastInfoChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Pseudo", DbType = "NVarChar(50) NOT NULL", CanBeNull = false)]
		[Required(ErrorMessage = "Veuillez indiquer votre Pseudo.")]
		[StringLength(50, MinimumLength = 2, ErrorMessage = "Votre Pseudo doit contenir entre 2 et 50 caractères.")]
		[Display(Name = "Pseudo")]
		public string Pseudo
		{
			get
			{
				return this._Pseudo;
			}
			set
			{
				if ((this._Pseudo != value))
				{
					this.OnPseudoChanging(value);
					this.SendPropertyChanging();
					this._Pseudo = value;
					this.SendPropertyChanged("Pseudo");
					this.OnPseudoChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Email", DbType = "NVarChar(255) NOT NULL", CanBeNull = false)]
		[Required(ErrorMessage = "Veuillez indiquer votre Email")]
		[RegularExpression("^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$", ErrorMessage = "Email invalide.")]
		[Display(Name = "Email")]
		public string Email
		{
			get
			{
				return this._Email;
			}
			set
			{
				if ((this._Email != value))
				{
					this.OnEmailChanging(value);
					this.SendPropertyChanging();
					this._Email = value;
					this.SendPropertyChanged("Email");
					this.OnEmailChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Validation", DbType = "TinyInt NOT NULL")]
		public byte Validation
		{
			get
			{
				return this._Validation;
			}
			set
			{
				if ((this._Validation != value))
				{
					this.OnValidationChanging(value);
					this.SendPropertyChanging();
					this._Validation = value;
					this.SendPropertyChanged("Validation");
					this.OnValidationChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Content", DbType = "NVarChar(500) NOT NULL", CanBeNull = false)]
		[Required(ErrorMessage = "Veuillez indiquer un message")]
		[StringLength(500, MinimumLength = 5, ErrorMessage = "Votre message doit contenir entre 5 et 500 caractères.")]
		[Display(Name = "Message")]
		public string Content
		{
			get
			{
				return this._Content;
			}
			set
			{
				if ((this._Content != value))
				{
					this.OnContentChanging(value);
					this.SendPropertyChanging();
					this._Content = value;
					this.SendPropertyChanged("Content");
					this.OnContentChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CreationDate", DbType = "DateTime NOT NULL")]
		public System.DateTime CreationDate
		{
			get
			{
				return this._CreationDate;
			}
			set
			{
				if ((this._CreationDate != value))
				{
					this.OnCreationDateChanging(value);
					this.SendPropertyChanging();
					this._CreationDate = value;
					this.SendPropertyChanged("CreationDate");
					this.OnCreationDateChanged();
				}
			}
		}

		public event PropertyChangingEventHandler PropertyChanging;

		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}

		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}

	[global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Reference")]
	public partial class Reference : INotifyPropertyChanging, INotifyPropertyChanged
	{

		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

		private int _id_Reference;

		private byte _ReferenceType;

		private string _Description;

		private string _Content;

		private System.DateTime _CreationDate;

		private System.DateTime _EditDate;

		#region Extensibility Method Definitions
		partial void OnLoaded();
		partial void OnValidate(System.Data.Linq.ChangeAction action);
		partial void OnCreated();
		partial void Onid_ReferenceChanging(int value);
		partial void Onid_ReferenceChanged();
		partial void Onid_UserChanging(int value);
		partial void Onid_UserChanged();
		partial void OnReferenceTypeChanging(byte value);
		partial void OnReferenceTypeChanged();
		partial void OnDescriptionChanging(string value);
		partial void OnDescriptionChanged();
		partial void OnContentChanging(string value);
		partial void OnContentChanged();
		partial void OnCreationDateChanging(System.DateTime value);
		partial void OnCreationDateChanged();
		partial void OnEditDateChanging(System.DateTime value);
		partial void OnEditDateChanged();
		#endregion

		public Reference()
		{
			OnCreated();
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_id_Reference", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
		public int id_Reference
		{
			get
			{
				return this._id_Reference;
			}
			set
			{
				if ((this._id_Reference != value))
				{
					this.Onid_ReferenceChanging(value);
					this.SendPropertyChanging();
					this._id_Reference = value;
					this.SendPropertyChanged("id_Reference");
					this.Onid_ReferenceChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_ReferenceType", DbType = "TinyInt NOT NULL")]
		public byte ReferenceType
		{
			get
			{
				return this._ReferenceType;
			}
			set
			{
				if ((this._ReferenceType != value))
				{
					this.OnReferenceTypeChanging(value);
					this.SendPropertyChanging();
					this._ReferenceType = value;
					this.SendPropertyChanged("ReferenceType");
					this.OnReferenceTypeChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Description", DbType = "NVarChar(50) NOT NULL", CanBeNull = false)]
		public string Description
		{
			get
			{
				return this._Description;
			}
			set
			{
				if ((this._Description != value))
				{
					this.OnDescriptionChanging(value);
					this.SendPropertyChanging();
					this._Description = value;
					this.SendPropertyChanged("Description");
					this.OnDescriptionChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Content", DbType = "NText NOT NULL", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
		public string Content
		{
			get
			{
				return this._Content;
			}
			set
			{
				if ((this._Content != value))
				{
					this.OnContentChanging(value);
					this.SendPropertyChanging();
					this._Content = value;
					this.SendPropertyChanged("Content");
					this.OnContentChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CreationDate", DbType = "DateTime NOT NULL")]
		public System.DateTime CreationDate
		{
			get
			{
				return this._CreationDate;
			}
			set
			{
				if ((this._CreationDate != value))
				{
					this.OnCreationDateChanging(value);
					this.SendPropertyChanging();
					this._CreationDate = value;
					this.SendPropertyChanged("CreationDate");
					this.OnCreationDateChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_EditDate", DbType = "DateTime NOT NULL")]
		public System.DateTime EditDate
		{
			get
			{
				return this._EditDate;
			}
			set
			{
				if ((this._EditDate != value))
				{
					this.OnEditDateChanging(value);
					this.SendPropertyChanging();
					this._EditDate = value;
					this.SendPropertyChanged("EditDate");
					this.OnEditDateChanged();
				}
			}
		}

		public event PropertyChangingEventHandler PropertyChanging;

		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}

		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}

	[global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Comment")]
	public partial class Comment : INotifyPropertyChanging, INotifyPropertyChanged
	{
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

		private int _id_Comment;

		private int _id_Item;

		private byte _CommentType;

		private byte _Validation;

		private string _Email;

		private string _Pseudo;

		private string _Content;

		private System.DateTime _CreationDate;

		#region Extensibility Method Definitions
		partial void OnLoaded();
		partial void OnValidate(System.Data.Linq.ChangeAction action);
		partial void OnCreated();
		partial void Onid_CommentChanging(int value);
		partial void Onid_CommentChanged();
		partial void Onid_ItemChanging(int value);
		partial void Onid_ItemChanged();
		partial void OnCommentTypeChanging(byte value);
		partial void OnCommentTypeChanged();
		partial void OnValidationChanging(byte value);
		partial void OnValidationChanged();
		partial void OnEmailChanging(string value);
		partial void OnEmailChanged();
		partial void OnPseudoChanging(string value);
		partial void OnPseudoChanged();
		partial void OnContentChanging(string value);
		partial void OnContentChanged();
		partial void OnCreationDateChanging(System.DateTime value);
		partial void OnCreationDateChanged();
		#endregion

		public Comment()
		{
			OnCreated();
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_id_Comment", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
		public int id_Comment
		{
			get
			{
				return this._id_Comment;
			}
			set
			{
				if ((this._id_Comment != value))
				{
					this.Onid_CommentChanging(value);
					this.SendPropertyChanging();
					this._id_Comment = value;
					this.SendPropertyChanged("id_Comment");
					this.Onid_CommentChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_id_Item", DbType = "Int NOT NULL")]
		public int id_Item
		{
			get
			{
				return this._id_Item;
			}
			set
			{
				if ((this._id_Item != value))
				{
					this.Onid_ItemChanging(value);
					this.SendPropertyChanging();
					this._id_Item = value;
					this.SendPropertyChanged("id_Item");
					this.Onid_ItemChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CommentType", DbType = "TinyInt NOT NULL")]
		public byte CommentType
		{
			get
			{
				return this._CommentType;
			}
			set
			{
				if ((this._CommentType != value))
				{
					this.OnCommentTypeChanging(value);
					this.SendPropertyChanging();
					this._CommentType = value;
					this.SendPropertyChanged("CommentType");
					this.OnCommentTypeChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Validation", DbType = "TinyInt NOT NULL")]
		public byte Validation
		{
			get
			{
				return this._Validation;
			}
			set
			{
				if ((this._Validation != value))
				{
					this.OnValidationChanging(value);
					this.SendPropertyChanging();
					this._Validation = value;
					this.SendPropertyChanged("Validation");
					this.OnValidationChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Email", DbType = "NVarChar(255) NOT NULL", CanBeNull = false)]
		[Required(ErrorMessage = "Veuillez indiquer votre Email")]
		[RegularExpression("^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$", ErrorMessage = "Email invalide.")]
		[Display(Name = "Email")]
		public string Email
		{
			get
			{
				return this._Email;
			}
			set
			{
				if ((this._Email != value))
				{
					this.OnEmailChanging(value);
					this.SendPropertyChanging();
					this._Email = value;
					this.SendPropertyChanged("Email");
					this.OnEmailChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Pseudo", DbType = "NVarChar(50) NOT NULL", CanBeNull = false)]
		[Required(ErrorMessage = "Veuillez indiquer votre Pseudo.")]
		[StringLength(50, MinimumLength = 2, ErrorMessage = "Votre Pseudo doit contenir entre 2 et 50 caractères.")]
		[Display(Name = "Pseudo")]
		public string Pseudo
		{
			get
			{
				return this._Pseudo;
			}
			set
			{
				if ((this._Pseudo != value))
				{
					this.OnPseudoChanging(value);
					this.SendPropertyChanging();
					this._Pseudo = value;
					this.SendPropertyChanged("Pseudo");
					this.OnPseudoChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Content", DbType = "NText NOT NULL", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
		[Required(ErrorMessage = "Veuillez indiquer un commentaire")]
		[StringLength(500, MinimumLength = 5, ErrorMessage = "Votre Commentaire doit contenir entre 5 et 500 caractères.")]
		[Display(Name = "Commentaire")]
		public string Content
		{
			get
			{
				return this._Content;
			}
			set
			{
				if ((this._Content != value))
				{
					this.OnContentChanging(value);
					this.SendPropertyChanging();
					this._Content = value;
					this.SendPropertyChanged("Content");
					this.OnContentChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CreationDate", DbType = "DateTime NOT NULL")]
		public System.DateTime CreationDate
		{
			get
			{
				return this._CreationDate;
			}
			set
			{
				if ((this._CreationDate != value))
				{
					this.OnCreationDateChanging(value);
					this.SendPropertyChanging();
					this._CreationDate = value;
					this.SendPropertyChanged("CreationDate");
					this.OnCreationDateChanged();
				}
			}
		}

		public event PropertyChangingEventHandler PropertyChanging;

		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}

		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}

	[global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Publication")]
	public partial class Publication : INotifyPropertyChanging, INotifyPropertyChanged
	{

		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

		private int _id_Publication;

		private string _Title;

		private string _Summary;

		private string _File;

		private int _Count;

		private System.DateTime _CreationDate;

		#region Extensibility Method Definitions
		partial void OnLoaded();
		partial void OnValidate(System.Data.Linq.ChangeAction action);
		partial void OnCreated();
		partial void Onid_PublicationChanging(int value);
		partial void Onid_PublicationChanged();
		partial void OnTitleChanging(string value);
		partial void OnTitleChanged();
		partial void OnSummaryChanging(string value);
		partial void OnSummaryChanged();
		partial void OnFileChanging(string value);
		partial void OnFileChanged();
		partial void OnCountChanging(int value);
		partial void OnCountChanged();
		partial void OnCreationDateChanging(System.DateTime value);
		partial void OnCreationDateChanged();
		#endregion

		public Publication()
		{
			OnCreated();
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_id_Publication", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
		public int id_Publication
		{
			get
			{
				return this._id_Publication;
			}
			set
			{
				if ((this._id_Publication != value))
				{
					this.Onid_PublicationChanging(value);
					this.SendPropertyChanging();
					this._id_Publication = value;
					this.SendPropertyChanged("id_Publication");
					this.Onid_PublicationChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Title", DbType = "NVarChar(255) NOT NULL", CanBeNull = false)]
		public string Title
		{
			get
			{
				return this._Title;
			}
			set
			{
				if ((this._Title != value))
				{
					this.OnTitleChanging(value);
					this.SendPropertyChanging();
					this._Title = value;
					this.SendPropertyChanged("Title");
					this.OnTitleChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Summary", DbType = "NVarChar(500) NOT NULL", CanBeNull = false)]
		public string Summary
		{
			get
			{
				return this._Summary;
			}
			set
			{
				if ((this._Summary != value))
				{
					this.OnSummaryChanging(value);
					this.SendPropertyChanging();
					this._Summary = value;
					this.SendPropertyChanged("Summary");
					this.OnSummaryChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Name = "[File]", Storage = "_File", DbType = "NVarChar(255) NOT NULL", CanBeNull = false)]
		public string File
		{
			get
			{
				return this._File;
			}
			set
			{
				if ((this._File != value))
				{
					this.OnFileChanging(value);
					this.SendPropertyChanging();
					this._File = value;
					this.SendPropertyChanged("File");
					this.OnFileChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Count", DbType = "Int NOT NULL")]
		public int Count
		{
			get
			{
				return this._Count;
			}
			set
			{
				if ((this._Count != value))
				{
					this.OnCountChanging(value);
					this.SendPropertyChanging();
					this._Count = value;
					this.SendPropertyChanged("Count");
					this.OnCountChanged();
				}
			}
		}

		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CreationDate", DbType = "DateTime NOT NULL")]
		public System.DateTime CreationDate
		{
			get
			{
				return this._CreationDate;
			}
			set
			{
				if ((this._CreationDate != value))
				{
					this.OnCreationDateChanging(value);
					this.SendPropertyChanging();
					this._CreationDate = value;
					this.SendPropertyChanged("CreationDate");
					this.OnCreationDateChanged();
				}
			}
		}

		public event PropertyChangingEventHandler PropertyChanging;

		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}

		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
}

